package snail19.baseAction;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import snail19.baseServer.UserServer;
import snail19.entity.User;

@Controller
@Scope("prototype")
public class UserAction extends BaseAction<User>    {
	@Resource(name="userServerImpl")
	private UserServer userServer;
	private User user;
	private List<User> users;

	public List<User> getUsers() {
		return users;
	}
	
	public String login(){
		this.users=userServer.findall();
		return "index";
	}
	
	public String delete(){
		this.userServer.deleteEntity(model);
		return "redirectAction";
	}
	
	public String edit(){
		//对model进行从新赋值
		this.model=userServer.getEntity(model.getId()); 
		return "edit";
	}
	
	public String update(){
		this.userServer.updateEntity(model);
		return"redirectAction";
	}
	
	
}
